home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmiSoft / Dev / misc / WHDLoad_dev.lha / WHDLoad / Src / imager-examples / Gremlin.islave.s < prev    next >
Encoding:
Text File  |  2001-11-17  |  2.9 KB  |  117 lines

  1.  
  2.         ; Gremlin Imager (Barfly assembler source)
  3.         ;
  4.         ; Written by Codetapper/Action in 1999!
  5.         ;
  6.         ; Gremlin uses the same disk format on the majority of
  7.         ; their games. Examples include Super Cars 1 and 2,
  8.         ; Switchblade 2, Zool, Zool 2 and many more.
  9.         ;
  10.         ; Track 1 of disk 1 is often a copy protection track, 
  11.         ; usually with the sync $4124. On some games it is a
  12.         ; standard Dos track. Change line 68 as required for
  13.         ; each game as you analyse it to include/skip tracks 0-1.
  14.         ;
  15.         ; Disk 1: Tracks 000-000: Sync ($4489), length $1600 bytes (Dos)
  16.         ;      Tracks 001-001: Sync ($4124), length $1800 bytes (Protection or Dos)
  17.         ;         Tracks 002-159: Sync ($4489), length $1800 bytes
  18.         ;
  19.         ; Disk 2: Tracks 000-159: Sync ($4489), length $1800 bytes
  20.  
  21.         incdir    include:
  22.         include    RawDIC.i
  23.  
  24.         SLAVE_HEADER
  25.         dc.b    1        ; Slave version
  26.         dc.b    0        ; Slave flags
  27.         dc.l    DSK_1        ; Pointer to the first disk structure
  28.         dc.l    Text        ; Pointer to the text displayed in the imager window
  29.  
  30.         IFD    BARFLY
  31.         OUTPUT    "Gremlin.islave"
  32.         IFND    .passchk
  33.         DOSCMD    "WDate  >T:date"
  34. .passchk
  35.         ENDC
  36.         ENDC
  37.  
  38.         dc.b    "$VER:"
  39. Text        dc.b    "Gremlin imager V1.0",10
  40.         dc.b    "by Codetapper/Action "
  41.         IFD    BARFLY
  42.         INCBIN    "T:date"
  43.         ELSE
  44.         dc.b    "(16.11.1999)"
  45.         ENDC
  46.         dc.b    0
  47.         cnop    0,4
  48.  
  49. ;=====================================================================
  50.  
  51. DSK_1        dc.l    DSK_2        ; Pointer to next disk structure
  52.         dc.w    1        ; Disk structure version
  53.         dc.w    DFLG_SWAPSIDES    ; Disk flags
  54.         dc.l    TL_1        ; List of tracks which contain data
  55.         dc.l    0        ; UNUSED, ALWAYS SET TO 0!
  56.         dc.l    FL_DISKIMAGE    ; List of files to be saved
  57.         dc.l    0        ; Table of certain tracks with CRC values
  58.         dc.l    0        ; Alternative disk structure, if CRC failed
  59.         dc.l    0        ; Called before a disk is read
  60.         dc.l    0        ; Called after a disk has been read
  61.  
  62. DSK_2        dc.l    0        ; Pointer to next disk structure
  63.         dc.w    1        ; Disk structure version
  64.         dc.w    DFLG_SWAPSIDES    ; Disk flags
  65.         dc.l    TL_2        ; List of tracks which contain data
  66.         dc.l    0        ; UNUSED, ALWAYS SET TO 0!
  67.         dc.l    FL_DISKIMAGE    ; List of files to be saved
  68.         dc.l    0        ; Table of certain tracks with CRC values
  69.         dc.l    0        ; Alternative disk structure, if CRC failed
  70.         dc.l    0        ; Called before a disk is read
  71.         dc.l    0        ; Called after a disk has been read
  72.  
  73. TL_1        TLENTRY 002,159,$1800,SYNC_STD,_RipTrack
  74.         TLEND
  75.         EVEN
  76.  
  77. TL_2        TLENTRY 000,159,$1800,SYNC_STD,_RipTrack
  78.         TLEND
  79.         EVEN
  80.  
  81. ;=====================================================================
  82.  
  83. _RipTrack    exg.l    a0,a1            ;Game uses a0 as dest
  84.                         ;and a1 as MFM
  85.         move.w    #$c00-1,d7
  86.         move.w    #$5555,d2
  87.         move.w    #0,d3
  88.  
  89. _Find5555    move.w    (a1)+,d0
  90.         cmpi.w    #$5555,d0
  91.         bne.b    _Find5555
  92.  
  93. _DecodeLoop    move.w    (a1)+,d0
  94.         move.w    (a1)+,d1
  95.         and.w    d2,d0
  96.         and.w    d2,d1
  97.         add.w    d1,d1
  98.         or.w    d1,d0
  99.         add.w    d0,d3
  100.         move.w    d0,(a0)+
  101.         dbra    d7,_DecodeLoop
  102.         move.w    (a1)+,d0
  103.         move.w    (a1)+,d1
  104.         and.w    d2,d0
  105.         and.w    d2,d1
  106.         add.w    d1,d1
  107.         add.w    d0,d1
  108.         move.w    d1,d7
  109.         cmp.w    d3,d7
  110.         bne.b    _Checksum
  111.  
  112. _OK        moveq    #IERR_OK,d0
  113.         rts
  114.  
  115. _Checksum    moveq    #IERR_CHECKSUM,d0
  116.         rts
  117.